﻿namespace TheRaces
{
    public class Bet
    {
        public int Dog; // The number of the dog the bet is on
        public int Amount; // The amount of cash  that was bet
        public Guy Bettor; // The guy who placed the bet

        public string GetDescription()
        {
            // Return a string that says who placed the bet, how much
            // cash was bet, and which dog he bet on ("Joe bets 8 on dog #4").
            // If the amount is zero, no bet was placed
            //("Joe hasn't placed a bet").
            if (Amount == 0)
            {
                return string.Format("{0} hasn't placed a bet", Bettor.Name);
            }
            return string.Format("{0} bets {1} on dog #{2}", Bettor.Name, Bettor.MyBet.Amount, Dog);
        }

        public int PayOut(int winner)
        {
            // The parameter is the winner of the race. If the dog won,
            // return the amount bet. Otherwise, return the negative of the amount bet.
            if (Dog == winner)
            {
                return Amount;
            }
            return Amount * -1;
        }
    }
}
